FROM fedora:latest

# Install required packages
RUN dnf update -y && \
    dnf install -y \
    clang \
    clang-tools-extra \
    cmake \
    curl \
    gdb \
    git \
    iproute \
    libasan \
    libubsan \
    ninja-build \
    procps \
    sudo \
    tar \
    unzip \
    which \
    zip

# 本Dockerfile 添加了一个非root用户`vscode`，具有sudo权限。但是对于Linux，
# 该用户的GID/UID必须与您的本地用户UID/GID匹配，以避免在绑定挂载时出现权限问题。
# 如果您的UID/GID不是1000 请更新USER_UID / USER_GID。有关详细信息，
# 请参阅https://aka.ms/vscode-remote/containers/non-root-user。
ARG USER_NAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN groupadd --gid $USER_GID $USER_NAME \
    && useradd --uid $USER_UID --gid $USER_GID -m $USER_NAME

# setup vcpkg
RUN git clone --depth=1 \
    --single-branch --branch=master \
    https://github.com/microsoft/vcpkg /home/$USER_NAME/vcpkg \
    && /home/$USER_NAME/vcpkg/bootstrap-vcpkg.sh \
    && /home/$USER_NAME/vcpkg/vcpkg integrate install \
    && /home/$USER_NAME/vcpkg/vcpkg install \
    fmt \
    gtest \
    RapidJSON \
    spdlog

COPY Dockerfile /tmp/Dockerfile
USER $USER_NAME
